package com.example.day06;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

public class ListTest {
    public static void main(String[] args) {
        // Iterable
        // List
        // Set
        // Map

        ArrayList<String> strings = new ArrayList<>();
        strings.add("s1");

        Vector<String> vector = new Vector<>();
        vector.add("v1");
        vector.add("v2");
        vector.add("v3");

        strings.addAll(0, vector);

        System.out.println(strings.get(0));
        System.out.println(strings.get(1));
        System.out.println(strings.get(3));

//        strings.clear();
        System.out.println(strings.contains("s1")); // Ctrl + Q

        strings.ensureCapacity(10000); // 性能的提升

        strings.add("s1");
        strings.add("s1");
        strings.add("s1");
        System.out.println(strings.size());

        System.out.println(strings.indexOf("s1"));
        System.out.println(strings.lastIndexOf("s1"));
        System.out.println(strings.isEmpty());
        strings.remove(0);
        System.out.println(strings.size());
        System.out.println(strings.get(0));

        strings.remove("s1");
        System.out.println(strings.size());
    }
}
